import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './common/css/common.css'
import flexible from './utils/flexible.js'
import 'vant/lib/index.css';
import Vant from 'vant';
import FastClick from 'fastclick'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import { Loading } from 'vant';

Vue.use(Loading);
FastClick.attach(document.body)
Vue.use(ElementUI);
Vue.use(Vant);
Vue.config.productionTip = false

// router.beforeEach((to, from, next) => {
//   const token = localStorage.getItem('user')
//   if (!token && to.path !== '/') {
//     next('/') // 跳转到登录页面
//   } else {
//     next() // 继续页面跳转
//   }
// })

import { createApp } from 'vue'
// import App from './App.vue'
// import './registerServiceWorker'
// import store from './store'
// import VConsole from 'vconsole';
// import router from './router'
// createApp(App).use(store).use(router).mount('#app')
//import getUser from "@/api/getUserInfo1";

// const getuser = async () =>{
//     await getUser.getUser();

// }
// 判断是否是pc设备
const isPc = () => {
    const userAgentInfo = navigator.userAgent;
    const Agents = ["Android", "iPhone",
        "SymbianOS", "Windows Phone",
        "iPad", "iPod"];
    let flag = true;
    for (let v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

//如果不是生产环境并且不是pc设备那么就显示调试
if (process.env.NODE_ENV != "prod" && !isPc()) {
    console.log(process.env.NODE_ENV);
    //  const vConsole = new VConsole();
}


new Vue({
  router,
  store,
  flexible,
//VConsole,
  render: h => h(App)
}).$mount('#app')
